<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="jquery/jquery.min.js"></script>

</head>
<body>
<button id="btn1">新增</button>
<button id="btn2">查询所有</button>
<button id="btn3">查询单个</button>
<button id="btn4">修改</button>
<button id="btn5">删除</button>
</body>
<script>
    $(function () {
        $('#btn1').click(function () {
            $.post("/employees", {id: 5, name: "ddd", age: 19}, function (data) {
                console.log(data);
            })
        });
        $('#btn2').click(function () {
            $.get("/employees", function (data) {
                console.log(data);
            })
        });
        //查询单个
        $('#btn3').click(function () {
            $.get("/employees/1", function (data) {
                console.log(data);
            })
        });
        //修改
       $('#btn4').click(function () {
           //除新增查询之外都用ajax
           $.ajax({
               url:"/employees",
               type:"put",
               data:{id:1,name:"ssss",age:18},
               success:function () {
                   console.log(data);
               }
           })
       });
       //删除
       $('#btn4').click(function () {
           //除新增查询之外都用ajax
           $.ajax({
               url:"/employees/1",
               type:"delete",
               success:function () {
                   console.log(data);
               }
           })
       });

    })

</script>
</html>